{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vocabulary size: 2738\n",
      "WARNING:tensorflow:From /usr/local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py:497: calling conv1d (from tensorflow.python.ops.nn_ops) with data_format=NHWC is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "`NHWC` for data_format is deprecated, use `NWC` instead\n",
      "Epoch 1/1 | Batch 0/73156 | train loss: 8.0001\n",
      "\n",
      "―常济左缸在牌州原竹铮勿髦桂训首夫见梵纺散前成秒柴～盛领润磁洛欢奕讷曙勿髦襄娄铮菠哼镦总货p仗平…娄铮便傅微斯〔罐究侧域校姿条盐情焊怀度幺春淡铭槐此琳饕加皿沟称鼎蘑班狗迟博舜凯余戊皿统器蠡炎砍蟒医贡饮\n",
      "\n",
      "Epoch 1/1 | Batch 10/73156 | train loss: 5.7351\n",
      "Epoch 1/1 | Batch 20/73156 | train loss: 4.2480\n",
      "Epoch 1/1 | Batch 30/73156 | train loss: 3.3198\n",
      "Epoch 1/1 | Batch 40/73156 | train loss: 2.8097\n",
      "Epoch 1/1 | Batch 50/73156 | train loss: 2.5045\n",
      "Epoch 1/1 | Batch 60/73156 | train loss: 2.3099\n",
      "Epoch 1/1 | Batch 70/73156 | train loss: 2.1559\n",
      "Epoch 1/1 | Batch 80/73156 | train loss: 2.0344\n",
      "Epoch 1/1 | Batch 90/73156 | train loss: 1.9478\n",
      "Epoch 1/1 | Batch 100/73156 | train loss: 1.8691\n",
      "\n",
      "北京市朝阳区西三环南路1号\n",
      "北京市海淀区西路1号\n",
      "北京市海淀区西三环南路1号\n",
      "北京市海淀区西三环中路1号\n",
      "北京市海淀区中路1号\n",
      "北京市海淀区中路1号\n",
      "北京市海淀区中关村镇大厦1号\n",
      "北京市海淀区中路1号\n",
      "\n",
      "Epoch 1/1 | Batch 110/73156 | train loss: 1.8052\n",
      "Epoch 1/1 | Batch 120/73156 | train loss: 1.7433\n",
      "Epoch 1/1 | Batch 130/73156 | train loss: 1.6763\n",
      "Epoch 1/1 | Batch 140/73156 | train loss: 1.6023\n",
      "Epoch 1/1 | Batch 150/73156 | train loss: 1.4943\n",
      "Epoch 1/1 | Batch 160/73156 | train loss: 1.4055\n",
      "Epoch 1/1 | Batch 170/73156 | train loss: 1.3552\n",
      "Epoch 1/1 | Batch 180/73156 | train loss: 1.2446\n",
      "Epoch 1/1 | Batch 190/73156 | train loss: 1.1530\n",
      "Epoch 1/1 | Batch 200/73156 | train loss: 1.0864\n",
      "\n",
      "京市朝阳区北苑路广场工业园区\n",
      "北京市朝阳区大望京市海淀区亚运通州区上地信息路2号楼1002\n",
      "北京市朝阳区惠园南路1号楼b座6\n",
      "北京市朝阳区亚运大郊亭南路1\n",
      "北京市朝阳区亚运村欧陆大厦A座1000000\n",
      "\n",
      "Epoch 1/1 | Batch 210/73156 | train loss: 1.0049\n",
      "Epoch 1/1 | Batch 220/73156 | train loss: 0.9485\n",
      "Epoch 1/1 | Batch 230/73156 | train loss: 0.8731\n",
      "Epoch 1/1 | Batch 240/73156 | train loss: 0.8303\n",
      "Epoch 1/1 | Batch 250/73156 | train loss: 0.7850\n",
      "Epoch 1/1 | Batch 260/73156 | train loss: 0.7657\n",
      "Epoch 1/1 | Batch 270/73156 | train loss: 0.7449\n",
      "Epoch 1/1 | Batch 280/73156 | train loss: 0.7127\n",
      "Epoch 1/1 | Batch 290/73156 | train loss: 0.6788\n",
      "Epoch 1/1 | Batch 300/73156 | train loss: 0.6362\n",
      "\n",
      "京市朝阳区北苑路7号院华居3号楼单元202室\n",
      "北京市朝阳区北苑1号楼103室\n",
      "北京市海淀区知春路108号楼103室\n",
      "北京市海淀区学清华东路1号4号佳园1号楼1号楼103室\n",
      "北京市海淀区学院路1号楼1号\n",
      "\n",
      "Epoch 1/1 | Batch 310/73156 | train loss: 0.6140\n",
      "Epoch 1/1 | Batch 320/73156 | train loss: 0.6276\n",
      "Epoch 1/1 | Batch 330/73156 | train loss: 0.5963\n",
      "Epoch 1/1 | Batch 340/73156 | train loss: 0.5785\n",
      "Epoch 1/1 | Batch 350/73156 | train loss: 0.5667\n",
      "Epoch 1/1 | Batch 360/73156 | train loss: 0.5567\n",
      "Epoch 1/1 | Batch 370/73156 | train loss: 0.5552\n",
      "Epoch 1/1 | Batch 380/73156 | train loss: 0.5470\n",
      "Epoch 1/1 | Batch 390/73156 | train loss: 0.5236\n",
      "Epoch 1/1 | Batch 400/73156 | train loss: 0.5093\n",
      "\n",
      "北京市海淀区世纪城晨月园\n",
      "北京市海淀区西苑一亩园21号\n",
      "北京市西大望路27号\n",
      "北京市朝阳区广渠门外大街８号优士阁Ｂ座２２０1－３室\n",
      "北京市海淀区宝盛里7号楼2单元202\n",
      "北京宣武区莲花池东路106号\n",
      "\n",
      "\n",
      "Epoch 1/1 | Batch 410/73156 | train loss: 0.4910\n",
      "Epoch 1/1 | Batch 420/73156 | train loss: 0.4775\n",
      "Epoch 1/1 | Batch 430/73156 | train loss: 0.4881\n",
      "Epoch 1/1 | Batch 440/73156 | train loss: 0.5074\n",
      "Epoch 1/1 | Batch 450/73156 | train loss: 0.4912\n",
      "Epoch 1/1 | Batch 460/73156 | train loss: 0.4996\n",
      "Epoch 1/1 | Batch 470/73156 | train loss: 0.4609\n",
      "Epoch 1/1 | Batch 480/73156 | train loss: 0.4560\n",
      "Epoch 1/1 | Batch 490/73156 | train loss: 0.4508\n",
      "Epoch 1/1 | Batch 500/73156 | train loss: 0.4590\n",
      "\n",
      "北京市海淀区世纪城晨月园\n",
      "北京市海淀区西苑一亩园21号\n",
      "北京市西大望路27号\n",
      "北京市朝阳区广渠门外大街８号优士阁Ｂ座２２０1－３室\n",
      "北京市海淀区宝盛里7号楼2单元202\n",
      "北京宣武区莲花池东路106号\n",
      "\n",
      "\n",
      "Epoch 1/1 | Batch 510/73156 | train loss: 0.4613\n",
      "Epoch 1/1 | Batch 520/73156 | train loss: 0.4646\n",
      "Epoch 1/1 | Batch 530/73156 | train loss: 0.4510\n",
      "Epoch 1/1 | Batch 540/73156 | train loss: 0.4440\n",
      "Epoch 1/1 | Batch 550/73156 | train loss: 0.4269\n",
      "Epoch 1/1 | Batch 560/73156 | train loss: 0.4247\n",
      "Epoch 1/1 | Batch 570/73156 | train loss: 0.4106\n",
      "Epoch 1/1 | Batch 580/73156 | train loss: 0.4111\n",
      "Epoch 1/1 | Batch 590/73156 | train loss: 0.4033\n",
      "Epoch 1/1 | Batch 600/73156 | train loss: 0.4236\n",
      "\n",
      "北京市东城区苏州胡同97号\n",
      "北京市开发区西周路68号\n",
      "北京市海淀泉宗路10号C-5-1\n",
      "北京市宣武区马连道万丰基业大厦21室\n",
      "北京市锣鼓巷福祥胡同11号\n",
      "北京市朝阳区立水桥北站明天生活馆A座602\n",
      "北\n",
      "\n",
      "Epoch 1/1 | Batch 610/73156 | train loss: 0.4195\n",
      "Epoch 1/1 | Batch 620/73156 | train loss: 0.4397\n",
      "Epoch 1/1 | Batch 630/73156 | train loss: 0.4120\n",
      "Epoch 1/1 | Batch 640/73156 | train loss: 0.4189\n",
      "Epoch 1/1 | Batch 650/73156 | train loss: 0.4061\n",
      "Epoch 1/1 | Batch 660/73156 | train loss: 0.4129\n",
      "Epoch 1/1 | Batch 670/73156 | train loss: 0.4204\n",
      "Epoch 1/1 | Batch 680/73156 | train loss: 0.4176\n",
      "Epoch 1/1 | Batch 690/73156 | train loss: 0.3888\n",
      "Epoch 1/1 | Batch 700/73156 | train loss: 0.4202\n",
      "\n",
      "北京市海淀区上地信息产业基地15号\n",
      "北京市海淀区北四环西路展春园2号4单元602\n",
      "北京市丰台区方庄方星园一区D座1106\n",
      "北京市海淀区远大路588号\n",
      "北京市海淀区苏州街小南庄37楼1142室\n",
      "北京市朝\n",
      "\n",
      "Epoch 1/1 | Batch 710/73156 | train loss: 0.4106\n"
     ]
    }
   ],
   "source": [
    "# -*- coding: utf-8 -*-\n",
    "from self_attn_lm import LM\n",
    "from io import open\n",
    "\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    with open('./temp/beijing.txt', encoding='utf-8') as f:\n",
    "        text = f.read()\n",
    "    \n",
    "    model = LM(text, seq_len=100)\n",
    "    log = model.fit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
